package org.proxywars.engine.hud.valuebar;

import java.util.ArrayList;

import com.jme.renderer.ColorRGBA;

/**
 * This interface describes a ValueBarLayer.
 * Each layer makes up a piece of a value bar, background, color, text, foreground, highlight.
 * Most layers have the same basic functionality, but use different settings to fit their function.
 * 
 * @author Steven DeVries
 */
public interface InterfaceValueBarLayer {
    
    /*  Bar Value Methods */
    /**
     * Get the current value of the layer.
     * @return  the current value of the layer.
     */
    public int getCurrent();
    
    /**
     * Get the max value of the layer.
     * @return  the max value of the layer.
     */
    public int getMax();
    
    /**
     * Get the min value of the layer.
     * @return  the min value of the layer.
     */
    public int getMin();
    
    /**
     * Set the current value of the bar.
     * @param current       current value of the bar.
     */
    void setCurrent(int current);
    
    /**
     * Set the max value the bar can display.
     * @param max       max value bar can display.
     */
    void setMax(int max);    
    
    /**
     * Set the minimum value the bar can display.
     * @param min       minimum value the bar can display.
     */
    void setMin(int min);
    
    
    /* Display Methods*/    
    /**
     * Sets the alignment of the layer.
     * The layer is filled from the aligned side 
     * (e.g. left alignment starts on the left and fills to the right.)
     * 
     * @param horizontal    Horizontal alignment constant.
     * @param vertical        Vertical alignment constant.
     */
    void setAlign(int horizontal, int vertical);
    
    /**
     * Sets the location of the ValueBarLayer on the screen.
     * This function uses traditional axes (0,0) being top left corner.
     * The top, left corner of the bar will be at the specified point.
     * 
     * @param x     horizontal starting point.
     * @param y     vertical starting point.
     */
    void setLocation(int x, int y);
    
    /**
     * Sets the size of the bar in pixels on screen.
     * 
     * @param width     width of the bar.
     * @param height    height of the bar.
     */
    void setSize(int width, int height);
    
    

    /*  Color Settings Methods */
    /**
     * Sets the color to paint the bar with.
     * Also turns off image texture painting.
     * 
     * @param color     RGBA color of the bar.
     */
    void setColor(ColorRGBA color);
    
    /**
     * Sets the range of colors for this bar to use when painting itself.
     * Using the full/empty colors, the bar generates a color to paint itself with 
     * based on the current value of the bar.
     * 
     * @param emptyColor    color to display when bar is empty.
     * @param fullColor         color to display when bar is full.
     * @param numColors     number of colors between the full and empty color.
     */
    void setColorRange(ColorRGBA emptyColor, ColorRGBA fullColor, int numColors);
    
    /**
     * Sets the range of colors for this bar to use when painting itself.
     * This argument takes an array of colors so that you can go between any number of colors.
     * <p>
     * The distribution of colors is equal, meaning if you supply an array of red, yellow, and green,
     * with 5 colors, the function sets an array with 5 colors from red to yellow, 
     * and 5 from yellow to green.
     * <p>
     * To make the bar stay one color longer 
     * (e.g. green until half full, then yellow until quarter, then red)
     * Repeat the same color in the parameter array - red, yellow, green, green.
     *<p>
     * Note: the number of colors is per transition.  Meaning if the supplied array has 3 colors 
     * and numColors is 10, the resulting array will be 20 colors.  10 from color 1 to 2, 
     * and another 10 from color 2 to 3.
     * 
     * @param colorArray    Array of colors starting with empty color, ending in full color.
     * @param numColors   the number of colors per transition.
     */
    void setColorRange(ArrayList<ColorRGBA> colorArray, int numColors);
    
}
